package cn.eonshine.cuba.inf.modular.biz.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.eonshine.cuba.inf.modular.biz.entity.RoadGps;
import cn.eonshine.cuba.inf.modular.biz.mapper.RoadGpsMapper;
import cn.eonshine.cuba.inf.modular.biz.service.IRoadGpsService;
import cn.eonshine.cuba.inf.modular.common.service.AbstractCommonService;

@Service
@Transactional
public class RoadGpsServiceImpl extends AbstractCommonService<RoadGpsMapper, RoadGps> implements IRoadGpsService {

	@Override
	public int transportDataHandle(RoadGps obj, int count) throws Exception {
		
		QueryWrapper<RoadGps> entity = new QueryWrapper<RoadGps>();
		entity.lambda().eq(RoadGps::getRoadTankerId, obj.getRoadTankerId());
		entity.lambda().eq(RoadGps::getDataInputDatetime, obj.getDataInputDatetime());
		
		boolean isSuccess = false;
		if(this.isUpdate==0){
			isSuccess = remove(entity);
		}else {
			isSuccess = update(obj, entity);
		}
		if(isSuccess) {
			count ++;
		}
		return count;
	}

	@Override
	public void mappingHandle(RoadGps obj) throws Exception {
		
	}

	@Override
	public boolean isUseCutomerSelectSQL() {
		return false;
	}

	
}
